package A010map;

import java.util.HashMap;
import java.util.Iterator;
import java.util.Set;

public class D006_Map快速失败 {
    public static void main(String[] args) {

        HashMap hashMap = new HashMap();
        hashMap.put("不只Java-1", 1);
        hashMap.put("不只Java-2", 2);
        hashMap.put("不只Java-3", 3);

        Set set = hashMap.entrySet();
        Iterator iterator = set.iterator();
        while (iterator.hasNext()) {
            System.out.println(iterator.next());
            hashMap.put("下次循环会抛异常", 4);
            System.out.println("此时 hashMap 长度为" + hashMap.size());
        }


//        HashMap<String, String> map = new HashMap<>();
//
//        map.put("a", "a");
//        map.put("b", "b");
//        map.put("c", "c");
//
//
//        for (Map.Entry<String, String> entry:  map.entrySet()) {
//            System.out.println(entry.getKey() + "\t" + entry.getValue());
//            map.put("d", "d");
//        }
    }
}
